package com.lx.ngsl.exam.quest.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.lx.ngsl.exam.quest.entity.WrongEntity;

public interface WrongRepository extends JpaRepository<WrongEntity, String> {

	
	@Query("select count(0) from WrongEntity w where w.userId = :userId")
	int countByUser(@Param("userId") String userId);
	
	@Query("select w.questId from WrongEntity w where w.userId = :userId and w.paperId = :paperId order by w.id")
	List<String> wrongQuestIds(@Param("userId") String userId,@Param("paperId") String paperId);
	
	List<WrongEntity> findByQuestIdAndUserIdAndPaperId(String questId,String userId,String paperId);
	
	List<WrongEntity> findByQuestIdAndUserIdAndTestId(String questId,String userId,String testId);
}
